<?php
/**
 * Created by PhpStorm.
 * User: meng
 * Date: 2023/10/12
 * Time: 10:43
 */

namespace app\admin\validator;

use lib\common\CommonValidator;

class PermissionValidator extends CommonValidator
{
    protected $rule = [
        'id'      => 'require|postive',
        'name'    => 'require|max:32',
        'remarks' => 'max:255',
        'menus'   => 'require|array',
    ];

    protected $message = [
        'id'            => 'ID必填且只能是正整数',
        'name'          => '权限组名称必填, 不能超过32字符',
        'remarks'       => '备注信息不能超过255字符',
        'menus.require' => '请选择权限',
        'menus.array'   => '权限只能是数组'
    ];

    protected $scene = [
        'create' => ['name', 'remarks', 'menus'],
        'update' => ['id', 'name', 'remarks', 'menus']
    ];
}
